/*
 * Copyright (C) 2016 yixun All Rights Reserved.
 * 
 * CodeTypeEnum.java
 */
package com.emm.yixun.common.model.enums;
import java.io.Serializable;
import org.apache.commons.lang.StringUtils;
/**
 * 
 * 用户兼容app获取业务参数的老接口，当传入的是数字标识时，转换成英文标识
 * jzliu
 * @version 1.00
*/
public enum BaseCodeTypeConvertEnum implements Serializable{
		TYPE_ONE("1","informedWay",null), //获知途径
		TYPE_TWO("2","customerNature",null), //客户性质
		TYPE_THREE("3","theirMotives",null), //置业动机
		TYPE_FOUR("4","focus",null), //关注重点
		TYPE_FIVE("5","floor",null), //需求楼层
		TYPE_SIX("6","lifeService",null), //生活服务
		TYPE_SEVEN("7","lifeSupport",null), //生活配套
		TYPE_EIGHT("8","courtyardFunction",null), //希望庭院具备功能
		TYPE_NINE("9","familyJie",null), //家庭结构
		TYPE_TEN("10","currentlyProperty",null), //目前居住的物业类型
		TYPE_ELEVEN("11","contactWay",null), //首次接触方式
		TYPE_TWELVE("12","documentType",null), //证件类型
		TYPE_THIRTEEN("13","frameBrand",null), //车驾品牌
		TYPE_FOURTEEN("14","activityType",null), //乐于参加的活动类型
		TYPE_FIFTEEN("15","hobby",null), //兴趣爱好
		TYPE_SIXTEEN("16","richangxinxi",null), //日常信息获知途径
		TYPE_SEVENTEEN("17","currentlyStructure",null), //目前居住的户型结构
		TYPE_EIGHTEEN("18","academicQualifications",null), //学历
		TYPE_NINETEEN("19","congshihangye",null), //从事行业
		TYPE_TWENTY("20","companyXingzhi",null), //公司性质
		TYPE_TWENTY_ONE("21","contactInformation",null), //联系方式
		TYPE_TWENTY_TWO("22","currentlyHouse",null) //目前居住/办公的房子属性
		;
		
		private final String no;
		private final String des;
		private final Enum parent;
		
		/**
		 * 私有构造函数
		 * @param code
		 * @param description
		 */
		BaseCodeTypeConvertEnum(String no, String des,Enum parent) {
			this.no = no;
			this.des = des;
			this.parent = parent;
		}

		/**
		 * @return Returns the no.
		 */
		public String getNo() {
			return no;
		}

		/**
		 * @return Returns the des.
		 */
		public String getDes() {
			return des;
		}
		
		/**
		 * @return Returns the parent.
		 */
		public Enum getParent() {
			return parent;
		}

		/**
		 * 通过枚举<code>des</code>获得枚举
		 * 
		 * @param des
		 * @return
		 */
		public static BaseCodeTypeConvertEnum getByDescription(String des) {
			if(StringUtils.isBlank(des)){
				return null;
			}
			for (BaseCodeTypeConvertEnum menum : values()) {
				if (menum.getDes().equals(des)) {
					return menum;
				}
			}
			return null;
		}
		public static BaseCodeTypeConvertEnum getByNo(String no) {
			if(StringUtils.isBlank(no)){
				return null;
			}
			for (BaseCodeTypeConvertEnum menum : values()) {
				if (menum.getNo().equals(no)) {
					return menum;
				}
			}
			return null;
		}
}
